#include "SceneViewer.hpp"

SceneViewer::SceneViewer(QWidget *parent)
    : QOpenGLWidget{parent}
{
    QSurfaceFormat format;

    this->setFormat(format);
}

SceneViewer::~SceneViewer()
{
    makeCurrent();
    release();
    doneCurrent();
}

void SceneViewer::initializeGL()
{
    initializeOpenGLFunctions();
    // glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
    // glClearColor(0.247, 0.247, 0.247, 1.0f);
    this->glClearColor(0.08f, 0.09f, 0.12f, 1.0f);
    this->glEnable(GL_DEPTH_TEST);
    this->glEnable(GL_PROGRAM_POINT_SIZE);
    QOpenGLWidget::initializeGL();
}
void SceneViewer::resizeGL(int w, int h)
{
    this->glViewport(0, 0, w, h);
    QOpenGLWidget::resizeGL(w, h);
}
void SceneViewer::paintGL()
{
    this->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    QOpenGLWidget::paintGL();
}
void SceneViewer::release() {}
